package com.itheima.array;

import java.util.ArrayList;

//构造方法
public class ArrayListDemo01 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        list.add("Java");  //index:0
        list.add("SE");    //index:1
        list.add("Java");  //index:2
        list.add("EE");    //index:3
        System.out.println(list);//[Java, SE, Java, EE]
        //list.add(3,"真棒");//[Java, SE, Java, 真棒, EE]

        //list.add(5,"真棒!");//IndexOutOfBoundsException: Index: 5
        list.add(4,"真棒");//[Java, SE, Java, EE, 真棒!]
        System.out.println(list);
    }
}
